<template>
  <div>
    <!-- 1.0 顶部的卡片 -->
    <Card :sonData="topData" />

    <!-- 2.0 地图的组件 -->
    <Map />
  </div>
</template>

<script>
import { homeData } from '@/api/home.js'
import Card from '@/components/Crad'
import Map from './components/Map.vue'

export default {
  components: {
    Card,
    Map
  },
  data() {
    return {
      topData: {}
    }
  },
  created() {
    this.getDatas()
  },
  methods: {
    async getDatas() {
      const users = JSON.parse(localStorage.getItem('users') || '{}')
      const { data } = await homeData({
        member_id: users.member_id,
        access_token: users.access_token
      })
      this.topData = data
    }
  }
}
</script>

<style lang="less" scoped></style>
